//快捷键运行代码Ctrl+Alt+E
//单行注释用//；多行注释用/*……*/，内部不能嵌套多行注释；快捷键ctrl+/
#include<stdio.h> //标准输入输出库文件
#include<math.h> //标准数学库头文件 eg.sqrt(x)=x开根号；eg.pow(a,b)=a的b次方

int main()
{

    printf("hello\n");
    printf("She said \"ok\"");//转义字符
    
    //变量
    int num=80;
    char A='A';
    printf("the number is %d and the character is %c,it's ASCII is %d\n",num,A,A);
    printf("the size of char is %zu",sizeof(char));

    float num1=11.27;
    float num2=11.12345678910;
    printf("num1 is %f\nnum2 is %f\n",num1,num2);
    double num3=11.12345678910;
    printf("the float is %.10f \nthe double is %.10lf",num2,num3);//num2 float类型在打印10位的时候出现了精度损失

    int res1=2+10/8*3;  //5 int类型进行四舍五入
    double res2=2+10/8.0*3;  //5.750000
    printf("the res1 is %d\nthe res2 is %f\n",res1,res2);


    //求根公式，eg.取地址，if循环   //哇~简直跟nm有鬼一样 
    printf("please enter the coefficient a,b,c as:\n");  //结果就一个换行符的问题，真是老奶奶钻被窝，给爷气笑了
    int a,b,c; 
    double x1,x2;
    double delta;

    //scanf("the equation is:%dx*2+%dx+%d\n",&a,&b,&c);
    scanf("%d %d %d",&a,&b,&c);
    delta=pow(b,2)-4*a*c;
    // printf("%lf",delta);
    x1=(-b+sqrt(delta))/(2*a);
    x2=(-b-sqrt(delta))/(2*a);

    printf("the result is:");

    if(delta<0){
        printf("there's no solution\n");
    }
    else if(delta>0){
        printf("x1=%lf,x2=%lf\n",x1,x2);
        }
        else{
            printf("x1=x2=%lf\n",x1);
        }
    

    int a,b;
    printf("please enter:\n"); //部分windows默认不自动刷新无换行符的输出
    scanf("%d %d",&a,&b); 

    if(a>b){
        printf("the differ is %d",a-b);
    }
    else{
        printf("the differ is %d",b-a);
    }


    //for循环
    for(int i=2;i<=50;i=i+2){
        if(i%3==0){
            continue;
        }
        printf("%d\t",i);
    }

    //数组
    int arr[5];
    int num;

    printf("please enter:\n");
    for(int i=1;i<=5;i++){
        scanf("%d",&num);
        arr[i]=num;
        printf("%d\t",arr[i]);
    }


    //指针
    char ch='A';
    char* prt=&ch;
    *prt='a';
    // printf("%p",*prt); //输出地址
    printf("%c",ch);

    return 0;
}